import ROUTES from './routes'
import core from './core'

export default class web extends core {
    constructor() {
        super()
    }
    defineFunc() {
        /**
         * 用来显示debug相关方法
         */
        window.TongBridge = {
            paths: {},
            tokenExpired: () => { },
            newWebview: (path) => { window.location.href = (window.origin + path) },
            showImage: (val) => { alert(val) },
            showShareDialog: () => { },
            setStatusBarDarkFont: () => { },
            setMainTabVisibility: () => { },
            vibrate: () => { },
            uploadSuccess: () => { },
            chooseImage: () => { },
            cancelUpload: () => { },
            getClientInfo: () => { return JSON.stringify(window.TongBridge.clientInfo) },
            routeTo: () => { },
            invokeSystemBrowser: (params) => {
                window.location.href = JSON.parse(params).url;
            },
            goto: (path, params) => {
                window.location.href = path
            },
            goBack: (path, params) => {
                window.history.back()
            },
            clientInfo: {
                isWeb: true,
                safeBottom: window.safeBottom || 0,
                safeTop: window.safeTop || 0,
                location: { longitude: 116.460704, latitude: 39.9579, accuracy: 46.963593 },
                user: {
                    name: "通通用户", avatar: "https://img1.baidu.com/it/u=3659556470,999557894&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
                    // token: "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNzE1OTEwODQ0NDcwMjE5NTcxMiIsImlzcyI6InRvbmd0b25nIiwic3ViIjoiNzE1OTEwODQ0NDcwMjE5NTcxMiIsImV4cCI6MTcxMzQ5NTY4OCwiaWF0IjoxNzEwOTAzNjg4fQ.QdMbpnZPkmEIuPPlpkj8olDqyuq5tTRLmIX1j426s00"
                },
                appVersion: '1.4.0',
                bridgeVersion: 3,
            }
        }
    }
}